package flc.ast.fragment;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import flc.ast.R;
import flc.ast.activity.SelPicActivity;
import flc.ast.databinding.FragmentImageBinding;
import flc.ast.utils.Content;
import stark.common.basic.base.BaseNoModelFragment;
import stark.common.basic.event.EventStatProxy;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link ImageFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class ImageFragment extends BaseNoModelFragment<FragmentImageBinding> {


    @Override
    protected int onCreate() {
        return R.layout.fragment_image;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(getActivity(), mDataBinding.event1Container);
        mDataBinding.ivPicCut.setOnClickListener(this);
        mDataBinding.ivPicDecal.setOnClickListener(this);
        mDataBinding.ivPicDoodle.setOnClickListener(this);
        mDataBinding.ivPicFilter.setOnClickListener(this);
        mDataBinding.ivPicRotate.setOnClickListener(this);
        mDataBinding.ivPicMosaic.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()){
            case R.id.ivPicFilter://滤镜
                gotoSelPic(Content.Edit_Filter);
                break;
            case R.id.ivPicDecal://贴纸
                gotoSelPic(Content.Edit_Sticker);
                break;
            case R.id.ivPicDoodle://涂鸦
                gotoSelPic(Content.Edit_Doodle);
                break;
            case R.id.ivPicCut://裁剪
                gotoSelPic(Content.Edit_Cut);
                break;
            case R.id.ivPicRotate://旋转
                gotoSelPic(Content.Edit_Rotate);
                break;
            case R.id.ivPicMosaic://马赛克
                gotoSelPic(Content.Edit_Mosaic);
                break;
        }
    }

    @Override
    protected void initData() {

    }

    //去到选择图片界面
    private void gotoSelPic(String flag) {
        Intent intent = new Intent(mContext, SelPicActivity.class);
        intent.putExtra(Content.Flag, flag);
        startActivity(intent);
    }

}